home *** CD-ROM | disk | FTP | other *** search
- Path: news.iadfw.net!usenet
- From: alpet@airmail.net (Adam Peterson)
- Newsgroups: comp.lang.c
- Subject: Re: HELP: Illegal Pointer Arithmetic
- Date: Fri, 23 Feb 1996 04:15:56 GMT
- Organization: customer of Internet America
- Message-ID: <4gj85g$o0h@news-f.iadfw.net>
- References: <4gj0ug$730@news.one.net>
- NNTP-Posting-Host: dal24-12.ppp.iadfw.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- Oren Levin <oren@one.net> wrote:
-
- >I was wondering if someone could help me. I'm in the midst of learning
- >C/C++ and am trying to program the examples in Andrew Birnstock and John
- >Rex's book "Practical Algorithyms for Programers." I am using Symentec's
- >Think C++ (v 6 - Mac).
- >The following code is giving me a "illegal pointer arithmetic" error.
- >I'm trying to strip the carrage return off of a line of text read from a
- >file.
-
- >TIA for the help.
- >Oren Levin
- >oren@one.net
-
- >=== code snippet ===
- > while (! feof (fin))
- > {
- > /* read a record */
- > if (fgets (buffer, 127, fin) == NULL)
- > break;
- >
- > /* get rid of the trailing carrage return */
- > buffer [strlen (buffer) - 1] = "\0";
-
- Try changing the "\0" to be '\0'.
-
- Adam
-
-
-